package com.itheima.app.controller;


import com.itheima.app.interceptor.UserHolder;
import com.itheima.app.manager.SoulManager;
import com.itheima.domain.db.Answers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.xml.ws.Response;
import java.util.List;
import java.util.Map;

@RestController
public class SoulController {

    @Autowired
    private SoulManager soulManager;

    //查询问卷列表
    @GetMapping("/testSoul")
    public ResponseEntity findPaperListVo() {
        // 调用manager
        return soulManager.findPaperListVo();
    }
    //提交问卷
    @PostMapping("/testSoul")
    public ResponseEntity submitPaper(
            @RequestBody Map<String, List<Answers>> map) {
        return soulManager.submitPaper(map);
    }

    //查看报告
    @GetMapping("/testSoul/report/{id}")
    public ResponseEntity getReport(@PathVariable Long id) {
        return soulManager.getReport(id);
    }
}